<template>
    <el-submenu :key="subdata.id" v-if="subdata.children">
        <template slot="title">{{subdata.title}}</template>
        <!-- 递归自己 -->
        <template v-for="d in subdata.children">
            <resub :key="d.id" :subdata="d"></resub>
        </template>
    </el-submenu>
    <el-menu-item :key="subdata.id" v-else>{{subdata.title}}</el-menu-item>
</template>
<script>
import elMenuItem from "../menu/el-menu-item.vue";
import elSubmenu from "../menu/el-submenu.vue";
export default {
    name:'resub', //定义了name就可以自己调用自己了
    components:{
        'el-menu-item':elMenuItem,
        'el-submenu':elSubmenu,
    },
    props:{
        subdata:{
            type:Object,
            default:()=>({})
        }
    }
}
</script>